@skrr-ai/cli 0.1.146 → 0.1.147

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (282) hide show
  1. package/dist/base-command.js +38 -21
  2. package/dist/commands/agent/message/send.d.ts +11 -0
  3. package/dist/commands/agent/message/send.js +34 -8
  4. package/dist/commands/agent-worker.js +2 -1
  5. package/dist/commands/agents/activity.js +2 -1
  6. package/dist/commands/agents/badge.js +10 -5
  7. package/dist/commands/agents/categories/index.js +2 -1
  8. package/dist/commands/agents/chat.d.ts +1 -0
  9. package/dist/commands/agents/chat.js +29 -1
  10. package/dist/commands/agents/create.js +4 -1
  11. package/dist/commands/agents/overview.js +2 -1
  12. package/dist/commands/agents/releases/create.js +2 -1
  13. package/dist/commands/agents/schedule-overview.js +3 -1
  14. package/dist/commands/agents/schedule.js +2 -1
  15. package/dist/commands/agents/spawn.js +9 -6
  16. package/dist/commands/agents/tools/auth.js +2 -1
  17. package/dist/commands/agents/tools/calls.js +2 -1
  18. package/dist/commands/agents/visibility.js +2 -1
  19. package/dist/commands/balance/show.js +17 -2
  20. package/dist/commands/balance/statement.js +2 -1
  21. package/dist/commands/commands.js +2 -1
  22. package/dist/commands/commitments/create.js +2 -1
  23. package/dist/commands/commitments/delivery.js +2 -1
  24. package/dist/commands/commitments/doctor.js +2 -1
  25. package/dist/commands/commitments/observations.js +2 -2
  26. package/dist/commands/commitments/operating-review.js +2 -1
  27. package/dist/commands/commitments/pack/preflight.js +2 -1
  28. package/dist/commands/commitments/trigger-status.js +2 -1
  29. package/dist/commands/convos/messages.js +2 -1
  30. package/dist/commands/daemon/logs.js +18 -9
  31. package/dist/commands/daemon/usage.js +2 -1
  32. package/dist/commands/dm/messages.js +2 -1
  33. package/dist/commands/dm/thread/messages.js +2 -1
  34. package/dist/commands/dm/threads.js +2 -1
  35. package/dist/commands/doctor.js +2 -1
  36. package/dist/commands/goals/key-results/assess.js +2 -1
  37. package/dist/commands/goals/key-results/history.js +2 -1
  38. package/dist/commands/harnesses/forget.js +2 -1
  39. package/dist/commands/harnesses/show.js +12 -6
  40. package/dist/commands/inbox/index.js +4 -3
  41. package/dist/commands/initiatives/decide.js +2 -1
  42. package/dist/commands/instructions/diff.js +2 -1
  43. package/dist/commands/instructions/show.js +2 -1
  44. package/dist/commands/login.js +4 -2
  45. package/dist/commands/machines/dedicated/cp.js +2 -1
  46. package/dist/commands/machines/dedicated/power/set.js +2 -1
  47. package/dist/commands/machines/show.js +2 -1
  48. package/dist/commands/memory/maintain.js +2 -1
  49. package/dist/commands/memory/read.js +2 -1
  50. package/dist/commands/memory/rebuild-index.js +2 -1
  51. package/dist/commands/memory/rebuild.js +2 -1
  52. package/dist/commands/memory/search.js +2 -1
  53. package/dist/commands/messages/list.js +2 -1
  54. package/dist/commands/revoke-daemon.js +2 -1
  55. package/dist/commands/revoke-token.js +2 -1
  56. package/dist/commands/search/all.js +14 -7
  57. package/dist/commands/search/workspace.js +2 -1
  58. package/dist/commands/set-capabilities.js +2 -1
  59. package/dist/commands/skills/browse.js +8 -2
  60. package/dist/commands/spaces/auto-executor/preview.js +3 -2
  61. package/dist/commands/spaces/auto-executor/runs.js +4 -1
  62. package/dist/commands/spaces/workflow-templates/extract.d.ts +1 -0
  63. package/dist/commands/spaces/workflow-templates/extract.js +9 -1
  64. package/dist/commands/spaces/workflows/events.js +6 -3
  65. package/dist/commands/spaces/workflows/run.js +5 -3
  66. package/dist/commands/spaces/workflows/update.js +2 -1
  67. package/dist/commands/store/gallery-admissions/preview.js +2 -1
  68. package/dist/commands/store/publishers/profile/handle.js +2 -1
  69. package/dist/commands/tasks/comments/anchor.js +23 -9
  70. package/dist/commands/tasks/complete.js +4 -2
  71. package/dist/commands/tasks/create-tree.js +7 -3
  72. package/dist/commands/tasks/create.js +2 -1
  73. package/dist/commands/tasks/deliverable/add.js +2 -1
  74. package/dist/commands/tasks/deliverable/archive.js +2 -1
  75. package/dist/commands/tasks/deliverable/list.js +2 -1
  76. package/dist/commands/tasks/expectations/assess.js +2 -1
  77. package/dist/commands/tasks/labels/create.js +2 -1
  78. package/dist/commands/tasks/preflight.js +4 -2
  79. package/dist/commands/tasks/ready.js +2 -1
  80. package/dist/commands/tasks/result/submit.js +2 -1
  81. package/dist/commands/tasks/updates/add.js +2 -1
  82. package/dist/commands/tasks/wait.js +2 -1
  83. package/dist/commands/token/list.js +2 -1
  84. package/dist/commands/token/mint.js +2 -1
  85. package/dist/commands/wiki/write.js +14 -7
  86. package/dist/hooks/command-not-found.js +2 -1
  87. package/dist/lib/agent-chat-start.d.ts +77 -0
  88. package/dist/lib/agent-chat-start.js +169 -0
  89. package/dist/lib/agent-config.js +2 -1
  90. package/dist/lib/agent-endpoints.js +4 -2
  91. package/dist/lib/agent-evals.js +2 -1
  92. package/dist/lib/agent-guide-reference-gate.js +22 -11
  93. package/dist/lib/agent-guides.js +4 -1
  94. package/dist/lib/agent-instructions.js +5 -1
  95. package/dist/lib/agent-ref.js +8 -4
  96. package/dist/lib/agent-trigger-listing.js +2 -1
  97. package/dist/lib/agentic-stream.js +8 -5
  98. package/dist/lib/api-error-reason.js +2 -1
  99. package/dist/lib/api-fetch.js +5 -3
  100. package/dist/lib/appData.js +6 -6
  101. package/dist/lib/appInstallations.js +10 -5
  102. package/dist/lib/appsCheck.js +2 -1
  103. package/dist/lib/auth-failure.js +2 -1
  104. package/dist/lib/auth-storage.js +2 -1
  105. package/dist/lib/balance.js +6 -3
  106. package/dist/lib/capability-matrix.js +4 -2
  107. package/dist/lib/cli-runtime.js +2 -1
  108. package/dist/lib/code-handover.js +8 -3
  109. package/dist/lib/command-hygiene.js +28 -12
  110. package/dist/lib/command-manifest.js +6 -3
  111. package/dist/lib/commitment-attention-copy.js +2 -1
  112. package/dist/lib/commitment-event-wakes.js +9 -0
  113. package/dist/lib/commitment-product.js +5 -3
  114. package/dist/lib/commitment-terms.js +2 -1
  115. package/dist/lib/commitments.d.ts +8 -0
  116. package/dist/lib/commitments.js +8 -4
  117. package/dist/lib/compasses.js +2 -1
  118. package/dist/lib/completion-index.js +2 -1
  119. package/dist/lib/computer-files.js +8 -6
  120. package/dist/lib/config.js +11 -5
  121. package/dist/lib/conversation-search.js +4 -2
  122. package/dist/lib/daemon-installer.js +6 -2
  123. package/dist/lib/daemon-maintenance.js +2 -1
  124. package/dist/lib/daemon-ref.js +2 -1
  125. package/dist/lib/daemonBroker.js +6 -3
  126. package/dist/lib/daemonBrokerRefusal.js +4 -2
  127. package/dist/lib/daemonHandoff.js +14 -7
  128. package/dist/lib/daemonIslandProfile.js +2 -1
  129. package/dist/lib/dedicated-copy.js +9 -3
  130. package/dist/lib/dedicated-exec.js +2 -1
  131. package/dist/lib/dedicated-keep-awake.js +2 -1
  132. package/dist/lib/dedicated-machines.js +9 -5
  133. package/dist/lib/dedicated-service.js +2 -1
  134. package/dist/lib/dedicated-ssh.js +5 -3
  135. package/dist/lib/deployed-build.js +2 -1
  136. package/dist/lib/device-code.js +4 -3
  137. package/dist/lib/dpop-auth.js +2 -1
  138. package/dist/lib/earnings.js +2 -1
  139. package/dist/lib/exec-runtime-binary.js +5 -3
  140. package/dist/lib/first-party-harness-broker.js +4 -3
  141. package/dist/lib/first-party-harness-managed.js +2 -1
  142. package/dist/lib/first-party-harness-startup-update.js +8 -4
  143. package/dist/lib/first-party-harness-update.js +2 -1
  144. package/dist/lib/first-party-harness.js +2 -1
  145. package/dist/lib/format.js +8 -4
  146. package/dist/lib/git-task.js +10 -5
  147. package/dist/lib/github-tools.js +6 -3
  148. package/dist/lib/harnesses.js +4 -2
  149. package/dist/lib/hosted-machines.js +2 -1
  150. package/dist/lib/html-text.js +33 -16
  151. package/dist/lib/instruction-blocks.js +2 -1
  152. package/dist/lib/iso-instant.js +5 -3
  153. package/dist/lib/keychain.js +15 -5
  154. package/dist/lib/label-scope.js +2 -1
  155. package/dist/lib/live-runtime-binary.js +10 -7
  156. package/dist/lib/local-skills.js +10 -6
  157. package/dist/lib/login.js +3 -2
  158. package/dist/lib/machine-audit.js +2 -1
  159. package/dist/lib/machine-daemon-log.js +2 -1
  160. package/dist/lib/machine-services.js +2 -1
  161. package/dist/lib/memory-history-session.js +2 -1
  162. package/dist/lib/memory-sync.js +6 -2
  163. package/dist/lib/message-intent.d.ts +10 -0
  164. package/dist/lib/node-adapter.js +4 -2
  165. package/dist/lib/northstars.js +4 -2
  166. package/dist/lib/oauthLogin.js +16 -7
  167. package/dist/lib/open-target.js +8 -4
  168. package/dist/lib/option-hint.js +2 -4
  169. package/dist/lib/outbox.js +2 -1
  170. package/dist/lib/planOutcome.d.ts +5 -3
  171. package/dist/lib/planOutcome.js +7 -4
  172. package/dist/lib/platform-update-local.js +2 -3
  173. package/dist/lib/rate-limit-retry.js +2 -1
  174. package/dist/lib/reflection.js +2 -1
  175. package/dist/lib/request-field-flags.js +2 -1
  176. package/dist/lib/runtime-start-verification.js +2 -1
  177. package/dist/lib/schedule.js +2 -1
  178. package/dist/lib/scoped-memory-command.js +7 -3
  179. package/dist/lib/search-display.js +11 -4
  180. package/dist/lib/skill-store-pagination.js +2 -1
  181. package/dist/lib/space-notebook.js +5 -3
  182. package/dist/lib/store-listing.js +2 -1
  183. package/dist/lib/task-agent-context-capabilities.js +2 -1
  184. package/dist/lib/task-asset-upload.js +7 -3
  185. package/dist/lib/task-closure.js +2 -1
  186. package/dist/lib/task-economics.js +2 -1
  187. package/dist/lib/task-execution.js +16 -8
  188. package/dist/lib/task-extras.js +4 -2
  189. package/dist/lib/task-operation-watch.js +2 -1
  190. package/dist/lib/task-preflight.js +3 -2
  191. package/dist/lib/task-recurrence-summary.js +4 -2
  192. package/dist/lib/task-runtime-headers.js +10 -5
  193. package/dist/lib/task-transcript.js +3 -2
  194. package/dist/lib/task-transfer.js +9 -5
  195. package/dist/lib/tasks.js +2 -1
  196. package/dist/lib/triggers.d.ts +15 -0
  197. package/dist/lib/triggers.js +32 -3
  198. package/dist/lib/update-check.js +12 -7
  199. package/dist/lib/usage-discovery.js +2 -1
  200. package/dist/lib/usd-micros.js +2 -1
  201. package/dist/lib/web-url.js +2 -1
  202. package/dist/lib/widgetCheck.js +15 -9
  203. package/dist/lib/widgetStaticScan.js +26 -14
  204. package/dist/lib/workflow-run-view.js +5 -3
  205. package/dist/lib/workflow-templates.d.ts +10 -0
  206. package/dist/lib/workflow-templates.js +47 -0
  207. package/dist/lib/write-target.js +4 -5
  208. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/authHelper.js +2 -1
  209. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/commitmentExecutionContract.js +22 -12
  210. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/computerUse.js +4 -1
  211. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/credentialEnvelope.js +7 -2
  212. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/credentialEnvelopeBridge.js +6 -3
  213. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/daemonConsentProof.js +2 -1
  214. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/daemonPair.js +16 -7
  215. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/daemonWire.js +4 -1
  216. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/desktopDaemonProof.js +4 -3
  217. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/desktopWire.js +2 -1
  218. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/deviceIdentityBridge.js +11 -7
  219. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/deviceKey.js +7 -2
  220. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/dpop.js +8 -3
  221. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/firstPartyHarness.js +2 -1
  222. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/firstPartyHarnessChannels.js +4 -3
  223. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/firstPartyHarnessUpdater.js +2 -1
  224. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/githubPushRefusal.js +4 -3
  225. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/guidedUpdate.js +2 -1
  226. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/independentMachineReservation.js +8 -3
  227. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/kek/macos.js +4 -2
  228. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/liveState.js +4 -2
  229. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/loginWithLocalhost.js +2 -1
  230. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/loopbackHttp.js +2 -1
  231. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/machineUuid.js +4 -2
  232. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/profileStateDir.js +2 -1
  233. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/recoveryCode.js +2 -1
  234. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/refresh.js +3 -2
  235. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/releasePolicy.js +2 -1
  236. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/releaseVersions.js +6 -4
  237. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/restartArtifact.js +2 -1
  238. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/spawnEnv.js +2 -1
  239. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/telemetryRedaction.js +7 -4
  240. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/toolApprovalSignature.js +2 -1
  241. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/authHelper.js +2 -1
  242. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/commitmentExecutionContract.js +27 -18
  243. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/computerUse.js +6 -3
  244. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/credentialEnvelope.js +11 -2
  245. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/credentialEnvelopeBridge.js +6 -3
  246. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/daemonConsentProof.js +2 -1
  247. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/daemonPair.js +20 -8
  248. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/daemonWire.js +5 -4
  249. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/desktopDaemonProof.js +4 -3
  250. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/desktopWire.js +2 -1
  251. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/deviceIdentityBridge.js +11 -7
  252. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/deviceKey.js +11 -2
  253. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/dpop.js +12 -3
  254. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/firstPartyHarness.js +2 -1
  255. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/firstPartyHarnessChannels.js +4 -3
  256. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/firstPartyHarnessUpdater.js +2 -1
  257. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/githubPushRefusal.js +4 -3
  258. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/guidedUpdate.js +5 -1
  259. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/independentMachineReservation.js +10 -5
  260. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/kek/macos.js +4 -2
  261. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/liveState.js +4 -2
  262. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/loginWithLocalhost.js +2 -1
  263. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/loopbackHttp.js +2 -1
  264. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/machineUuid.js +4 -2
  265. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/profileStateDir.js +2 -1
  266. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/recoveryCode.js +2 -1
  267. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/refresh.js +3 -2
  268. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/releasePolicy.js +2 -1
  269. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/releaseVersions.js +6 -4
  270. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/restartArtifact.js +2 -1
  271. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/spawnEnv.js +2 -1
  272. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/telemetryRedaction.js +11 -5
  273. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/toolApprovalSignature.js +2 -1
  274. package/dist/node_modules/@skrr-ai/auth-core/package.json +1 -1
  275. package/dist/node_modules/@skrr-ai/data-provider/index.js +20519 -20130
  276. package/dist/node_modules/@skrr-ai/inference-broker/dist/cjs/loopback-server.js +4 -2
  277. package/dist/node_modules/@skrr-ai/inference-broker/dist/cjs/managed-inference-broker.js +10 -6
  278. package/dist/node_modules/@skrr-ai/inference-broker/dist/esm/loopback-server.js +4 -2
  279. package/dist/node_modules/@skrr-ai/inference-broker/dist/esm/managed-inference-broker.js +10 -6
  280. package/dist/node_modules/@skrr-ai/inference-broker/package.json +1 -1
  281. package/oclif.manifest.json +17 -2
  282. package/package.json +1 -1
@@ -79,6 +79,21 @@ const dedicated_guest_1 = require("./lib/dedicated-guest");
79
79
  const harness_context_1 = require("./lib/harness-context");
80
80
  const task_resource_references_1 = require("./lib/task-resource-references");
81
81
  const tasks_1 = require("./lib/tasks");
82
+ const RESOLVE_TASK_RESOURCE_REFERENCES_RE = /^[\da-f-]{36}$/i;
83
+ const RESOLVE_TASK_RESOURCE_REFERENCES_RE_2 = /^[\da-f]{24}$/i;
84
+ const HANDLE_API_ERROR_RE = /\s*Run `[^`]+` to sign in again\.$/;
85
+ const HAS_REMEDY_LINE_RE = /^\s*→/m;
86
+ const UNSUPPORTED_FLAG_REMEDY_FOR_MESSAGE_RE = /Nonexistent flag[s]?:?\s*(-{1,2}[\w-]+)/i;
87
+ const UNSUPPORTED_FLAG_REMEDY_FOR_MESSAGE_RE_2 = /^-+/;
88
+ const MISSING_FLAG_REMEDY_FOR_MESSAGE_RE = /Missing required flag[s]?:?\s*(?:\n\s*)?-{0,2}([a-z][\w-]*)/i;
89
+ const RETIRED_FLAG_HINT_RE = /nonexistent flag/i;
90
+ const RETIRED_FLAG_HINT_RE_2 = /(?:^|[\s,:])(--[a-z][\w-]*)[ =]([^\s,][^,\n]*)/i;
91
+ const RETIRED_FLAG_HINT_RE_3 = /^--/;
92
+ const PARSE_ERROR_REMEDY_RE = /:/g;
93
+ const PARSE_ERROR_REMEDY_RE_2 = /\s+/g;
94
+ const PARSE_ERROR_REMEDY_RE_3 = /Nonexistent flag[s]?:?\s*(-{1,2}[\w-]+)(?:[ =]([^\s,][^,\n]*))?/i;
95
+ const PARSE_ERROR_REMEDY_RE_4 = /Missing \d+ required arg/i;
96
+ const PARSE_CLI_ERROR_CODE_RE = /([a-z0-9])([A-Z])/g;
82
97
  function assigneePayloadNeedsResolution(payload) {
83
98
  const fields = [
84
99
  ['assigneeUserIds', 'user'],
@@ -721,8 +736,8 @@ class BaseCommand extends core_1.Command {
721
736
  const value = payload[field];
722
737
  return (typeof value === 'string' &&
723
738
  value.trim() &&
724
- !/^[\da-f-]{36}$/i.test(value) &&
725
- !/^[\da-f]{24}$/i.test(value));
739
+ !RESOLVE_TASK_RESOURCE_REFERENCES_RE.test(value) &&
740
+ !RESOLVE_TASK_RESOURCE_REFERENCES_RE_2.test(value));
726
741
  });
727
742
  try {
728
743
  if (needsScope && !payload.spaceId && !existingTask && options.taskId) {
@@ -1730,7 +1745,7 @@ class BaseCommand extends core_1.Command {
1730
1745
  ? null
1731
1746
  : (0, daemonBrokerRefusal_1.describeBrokerFailure)(e.brokerFailure, this.config.bin);
1732
1747
  const renewal = refreshRefusal
1733
- ? refreshRefusal.message.replace(/\s*Run `[^`]+` to sign in again\.$/, '')
1748
+ ? refreshRefusal.message.replace(HANDLE_API_ERROR_RE, '')
1734
1749
  : "This CLI's own sign-in could not be renewed.";
1735
1750
  const authDiagnostic = this.authResolution();
1736
1751
  const details = {
@@ -2106,7 +2121,7 @@ class BaseCommand extends core_1.Command {
2106
2121
  ? (0, daemonBrokerRefusal_1.describeBrokerFailure)(e.brokerFailure, this.config.bin)
2107
2122
  : null;
2108
2123
  const why = (refusal
2109
- ? refusal.message.replace(/\s*Run `[^`]+` to sign in again\.$/, '')
2124
+ ? refusal.message.replace(HANDLE_API_ERROR_RE, '')
2110
2125
  : 'The server did not accept this sign-in.') +
2111
2126
  // OSK-12474 — the daemon was asked for a hand-off and refused; say why.
2112
2127
  (brokerRefusal ? ` ${brokerRefusal.headline}` : '');
@@ -2793,7 +2808,7 @@ function isRetryableFailure(status, body) {
2793
2808
  }
2794
2809
  /** True when a message already carries this CLI's `→` remedy line. */
2795
2810
  function hasRemedyLine(message) {
2796
- return /^\s*→/m.test(message);
2811
+ return HAS_REMEDY_LINE_RE.test(message);
2797
2812
  }
2798
2813
  /** The remedy a call site wrote into `details.suggestion`, if it wrote one. */
2799
2814
  function authoredSuggestion(details) {
@@ -2968,11 +2983,13 @@ function missingFlagRemedy(commandId, flag) {
2968
2983
  return commandId ? exports.MISSING_FLAG_REMEDIES[commandId]?.[flag] : undefined;
2969
2984
  }
2970
2985
  function unsupportedFlagRemedyForMessage(message, commandId) {
2971
- const match = /Nonexistent flag[s]?:?\s*(-{1,2}[\w-]+)/i.exec(message);
2972
- return match ? unsupportedFlagRemedy(commandId, match[1].replace(/^-+/, '')) : undefined;
2986
+ const match = UNSUPPORTED_FLAG_REMEDY_FOR_MESSAGE_RE.exec(message);
2987
+ return match
2988
+ ? unsupportedFlagRemedy(commandId, match[1].replace(UNSUPPORTED_FLAG_REMEDY_FOR_MESSAGE_RE_2, ''))
2989
+ : undefined;
2973
2990
  }
2974
2991
  function missingFlagRemedyForMessage(message, commandId) {
2975
- const match = /Missing required flag[s]?:?\s*(?:\n\s*)?-{0,2}([a-z][\w-]*)/i.exec(message);
2992
+ const match = MISSING_FLAG_REMEDY_FOR_MESSAGE_RE.exec(message);
2976
2993
  return match ? missingFlagRemedy(commandId, match[1]) : undefined;
2977
2994
  }
2978
2995
  /**
@@ -2982,18 +2999,18 @@ function missingFlagRemedyForMessage(message, commandId) {
2982
2999
  * which oclif reports only as an unknown flag.
2983
3000
  */
2984
3001
  function retiredFlagHint(message, commandId, definedFlags = []) {
2985
- if (!/nonexistent flag/i.test(message))
3002
+ if (!RETIRED_FLAG_HINT_RE.test(message))
2986
3003
  return null;
2987
3004
  const lines = [];
2988
- const quoted = /(?:^|[\s,:])(--[a-z][\w-]*)[ =]([^\s,][^,\n]*)/i.exec(message.slice(message.search(/nonexistent flag/i)));
3005
+ const quoted = RETIRED_FLAG_HINT_RE_2.exec(message.slice(message.search(RETIRED_FLAG_HINT_RE)));
2989
3006
  const quotedFlag = quoted?.[1];
2990
- if (quotedFlag && definedFlags.includes(quotedFlag.replace(/^--/, ''))) {
3007
+ if (quotedFlag && definedFlags.includes(quotedFlag.replace(RETIRED_FLAG_HINT_RE_3, ''))) {
2991
3008
  lines.push(` "${quoted[0].trim()}" reached the command as ONE argument, so it was read as a flag named ` +
2992
3009
  `"${quoted[0].trim()}". Pass the flag and its value separately: ${quotedFlag} ${quoted[2].trim()}`);
2993
3010
  }
2994
3011
  if (commandId && RETIRED_FLAG_COMMANDS.has(commandId)) {
2995
3012
  for (const flag of Object.keys(RETIRED_FLAG_REPLACEMENTS)) {
2996
- if (definedFlags.includes(flag.replace(/^--/, '')))
3013
+ if (definedFlags.includes(flag.replace(RETIRED_FLAG_HINT_RE_3, '')))
2997
3014
  continue;
2998
3015
  if (new RegExp(`${flag}(?![\\w-])`).test(message)) {
2999
3016
  lines.push(` ${RETIRED_FLAG_REPLACEMENTS[flag]}`);
@@ -3011,12 +3028,12 @@ function retiredFlagHint(message, commandId, definedFlags = []) {
3011
3028
  function parseErrorRemedy(err, commandId, bin = 'skrr') {
3012
3029
  if (err.code)
3013
3030
  return {};
3014
- const helpCommand = `${bin} ${(commandId ?? '').replace(/:/g, ' ')} --help`.replace(/\s+/g, ' ');
3031
+ const helpCommand = `${bin} ${(commandId ?? '').replace(PARSE_ERROR_REMEDY_RE, ' ')} --help`.replace(PARSE_ERROR_REMEDY_RE_2, ' ');
3015
3032
  const message = err.message || '';
3016
3033
  const suggestion = Array.isArray(err.suggestions)
3017
3034
  ? err.suggestions.find((s) => typeof s === 'string')
3018
3035
  : undefined;
3019
- const missingFlag = /Missing required flag[s]?:?\s*(?:\n\s*)?-{0,2}([a-z][\w-]*)/i.exec(message);
3036
+ const missingFlag = MISSING_FLAG_REMEDY_FOR_MESSAGE_RE.exec(message);
3020
3037
  if (missingFlag) {
3021
3038
  const flag = missingFlag[1];
3022
3039
  const missingFlagHint = missingFlagRemedy(commandId, flag);
@@ -3027,13 +3044,13 @@ function parseErrorRemedy(err, commandId, bin = 'skrr') {
3027
3044
  `Pass --${flag} <value>. Run \`${helpCommand}\` for its description and accepted values.`,
3028
3045
  };
3029
3046
  }
3030
- const nonexistent = /Nonexistent flag[s]?:?\s*(-{1,2}[\w-]+)(?:[ =]([^\s,][^,\n]*))?/i.exec(message);
3047
+ const nonexistent = PARSE_ERROR_REMEDY_RE_3.exec(message);
3031
3048
  const unsupportedFlagHint = nonexistent
3032
- ? unsupportedFlagRemedy(commandId, nonexistent[1].replace(/^-+/, ''))
3049
+ ? unsupportedFlagRemedy(commandId, nonexistent[1].replace(UNSUPPORTED_FLAG_REMEDY_FOR_MESSAGE_RE_2, ''))
3033
3050
  : undefined;
3034
3051
  if (unsupportedFlagHint) {
3035
3052
  return {
3036
- flag: nonexistent[1].replace(/^-+/, ''),
3053
+ flag: nonexistent[1].replace(UNSUPPORTED_FLAG_REMEDY_FOR_MESSAGE_RE_2, ''),
3037
3054
  fix: unsupportedFlagHint.fix,
3038
3055
  };
3039
3056
  }
@@ -3041,19 +3058,19 @@ function parseErrorRemedy(err, commandId, bin = 'skrr') {
3041
3058
  // `"--outcome failed"` arrived as ONE argument: the flag may well exist, so
3042
3059
  // "remove it" would be wrong advice. Same case retiredFlagHint explains in text.
3043
3060
  return {
3044
- flag: nonexistent[1].replace(/^-+/, ''),
3061
+ flag: nonexistent[1].replace(UNSUPPORTED_FLAG_REMEDY_FOR_MESSAGE_RE_2, ''),
3045
3062
  fix: suggestion ??
3046
3063
  `Pass the flag and its value as separate arguments: ${nonexistent[1]} ${nonexistent[2].trim()}`,
3047
3064
  };
3048
3065
  }
3049
3066
  if (nonexistent) {
3050
3067
  return {
3051
- flag: nonexistent[1].replace(/^-+/, ''),
3068
+ flag: nonexistent[1].replace(UNSUPPORTED_FLAG_REMEDY_FOR_MESSAGE_RE_2, ''),
3052
3069
  fix: suggestion ??
3053
3070
  `Remove ${nonexistent[1]}, or run \`${helpCommand}\` for the flags this command takes.`,
3054
3071
  };
3055
3072
  }
3056
- if (/Missing \d+ required arg/i.test(message)) {
3073
+ if (PARSE_ERROR_REMEDY_RE_4.test(message)) {
3057
3074
  return {
3058
3075
  fix: suggestion ?? `Supply the missing argument. Run \`${helpCommand}\` for the usage line.`,
3059
3076
  };
@@ -3062,7 +3079,7 @@ function parseErrorRemedy(err, commandId, bin = 'skrr') {
3062
3079
  }
3063
3080
  function parseCliErrorCode(err) {
3064
3081
  if (err.name && err.name !== 'Error') {
3065
- return err.name.replace(/([a-z0-9])([A-Z])/g, '$1_$2').toUpperCase();
3082
+ return err.name.replace(PARSE_CLI_ERROR_CODE_RE, '$1_$2').toUpperCase();
3066
3083
  }
3067
3084
  return 'CLI_PARSE_ERROR';
3068
3085
  }
@@ -245,8 +245,19 @@ export declare function buildEnvelope(input: {
245
245
  embeds?: EntityEmbed[];
246
246
  embedRejections?: WireEmbedRejection[];
247
247
  presentation?: CommunicationPresentation;
248
+ /** What the server applied to `presentation`; shown instead of the request when it differs. */
249
+ appliedPresentation?: Pick<CommunicationPresentation, 'kind' | 'attention' | 'attentionRequested'>;
248
250
  notificationPolicy?: 'normal' | 'silent';
249
251
  intent: CanonicalIntentEnvelope['intent'];
250
252
  }): CanonicalIntentEnvelope;
253
+ /**
254
+ * The sender's declared presentation, with the attention the server actually applied.
255
+ *
256
+ * The envelope used to echo the request, so a status declared `interrupt` and stored as `notify`
257
+ * still printed `interrupt` and the sender never learned its priority was lowered (OSK-22368).
258
+ * The requested value stays next to the applied one, only when they differ. An older server
259
+ * returns no presentation and the request is shown unchanged.
260
+ */
261
+ export declare function withAppliedAttention(declared: CommunicationPresentation, applied?: Pick<CommunicationPresentation, 'kind' | 'attention' | 'attentionRequested'>): CommunicationPresentation;
251
262
  export declare function formatEnvelope(envelope: CanonicalIntentEnvelope): string;
252
263
  export {};
@@ -44,6 +44,7 @@ exports.rejectPrincipalOverrides = rejectPrincipalOverrides;
44
44
  exports.normalizeIntentPayload = normalizeIntentPayload;
45
45
  exports.generateIdempotencyKey = generateIdempotencyKey;
46
46
  exports.buildEnvelope = buildEnvelope;
47
+ exports.withAppliedAttention = withAppliedAttention;
47
48
  exports.formatEnvelope = formatEnvelope;
48
49
  const crypto = __importStar(require("node:crypto"));
49
50
  const core_1 = require("@oclif/core");
@@ -54,6 +55,10 @@ const cli_runtime_1 = require("../../../lib/cli-runtime");
54
55
  const message_intent_1 = require("../../../lib/message-intent");
55
56
  const entity_embeds_1 = require("../../../lib/entity-embeds");
56
57
  const prompt_1 = require("../../../lib/prompt");
58
+ const BUILD_DESTINATION_RE = /^[^\s@<>]+@[^\s@<>]+\.[^\s@<>]+$/;
59
+ // eslint-disable-next-line no-control-regex -- Reject control characters in mail headers.
60
+ const BUILD_DESTINATION_RE_2 = /[\r\n\x00-\x1f\x7f]/;
61
+ const COMPACT_KEY_PART_RE = /[^A-Za-z0-9_.:-]/g;
57
62
  const MAX_TEXT_CHARS = 20000;
58
63
  const MAX_IDEMPOTENCY_KEY_CHARS = 240;
59
64
  const MAX_SEQUENCE_PARTS = data_provider_1.MAX_AGENT_MESSAGE_SEQUENCE_PARTS;
@@ -462,6 +467,7 @@ class AgentMessageSend extends base_command_1.BaseCommand {
462
467
  idempotencyKey: request.idempotencyKey,
463
468
  threadRootMessageId: request.threadRootMessageId,
464
469
  presentation: request.presentation,
470
+ appliedPresentation: result.presentation,
465
471
  notificationPolicy: request.notificationPolicy,
466
472
  embeds: request.embeds,
467
473
  embedRejections: result.embedRejections,
@@ -916,9 +922,7 @@ function buildDestination({ kind, bodyDestination, overlayChannel, overlayThread
916
922
  throw invalidIntent('agent_email requires 1 to 5 recipients.');
917
923
  }
918
924
  const recipients = rawRecipients.map((value) => {
919
- if (typeof value !== 'string' ||
920
- value.length > 254 ||
921
- !/^[^\s@<>]+@[^\s@<>]+\.[^\s@<>]+$/.test(value))
925
+ if (typeof value !== 'string' || value.length > 254 || !BUILD_DESTINATION_RE.test(value))
922
926
  throw invalidIntent('Invalid email recipient.');
923
927
  return value.toLowerCase();
924
928
  });
@@ -928,8 +932,7 @@ function buildDestination({ kind, bodyDestination, overlayChannel, overlayThread
928
932
  if (typeof subject !== 'string' ||
929
933
  !subject.trim() ||
930
934
  subject.length > 200 ||
931
- // eslint-disable-next-line no-control-regex -- Reject control characters in mail headers.
932
- /[\r\n\x00-\x1f\x7f]/.test(subject))
935
+ BUILD_DESTINATION_RE_2.test(subject))
933
936
  throw invalidIntent('Email subject must be a single line of at most 200 characters.');
934
937
  return { kind, recipients: recipients.sort(), subject: subject.trim() };
935
938
  }
@@ -1154,7 +1157,7 @@ function generateIdempotencyKey(agentId, payload) {
1154
1157
  return `cli:${crypto.randomUUID()}:agent-message:${digest}`;
1155
1158
  }
1156
1159
  function compactKeyPart(value) {
1157
- const cleaned = value.replace(/[^A-Za-z0-9_.:-]/g, '_');
1160
+ const cleaned = value.replace(COMPACT_KEY_PART_RE, '_');
1158
1161
  if (cleaned.length <= 80)
1159
1162
  return cleaned;
1160
1163
  const digest = crypto.createHash('sha256').update(value).digest('hex').slice(0, 16);
@@ -1170,6 +1173,9 @@ function statusFromLegacyDm(result) {
1170
1173
  return 'delivered';
1171
1174
  }
1172
1175
  function buildEnvelope(input) {
1176
+ const presentation = input.presentation
1177
+ ? withAppliedAttention(input.presentation, input.appliedPresentation)
1178
+ : undefined;
1173
1179
  return {
1174
1180
  ok: input.ok,
1175
1181
  protocolVersion: PROTOCOL_VERSION,
@@ -1183,7 +1189,7 @@ function buildEnvelope(input) {
1183
1189
  content: input.content,
1184
1190
  idempotencyKey: input.idempotencyKey,
1185
1191
  ...(input.threadRootMessageId ? { threadRootMessageId: input.threadRootMessageId } : {}),
1186
- ...(input.presentation ? { presentation: input.presentation } : {}),
1192
+ ...(presentation ? { presentation } : {}),
1187
1193
  ...(input.notificationPolicy ? { notificationPolicy: input.notificationPolicy } : {}),
1188
1194
  ...(input.embeds && input.embeds.length > 0 ? { embeds: input.embeds } : {}),
1189
1195
  ...(input.embedRejections && input.embedRejections.length > 0
@@ -1192,12 +1198,32 @@ function buildEnvelope(input) {
1192
1198
  intent: input.intent,
1193
1199
  };
1194
1200
  }
1201
+ /**
1202
+ * The sender's declared presentation, with the attention the server actually applied.
1203
+ *
1204
+ * The envelope used to echo the request, so a status declared `interrupt` and stored as `notify`
1205
+ * still printed `interrupt` and the sender never learned its priority was lowered (OSK-22368).
1206
+ * The requested value stays next to the applied one, only when they differ. An older server
1207
+ * returns no presentation and the request is shown unchanged.
1208
+ */
1209
+ function withAppliedAttention(declared, applied) {
1210
+ if (!applied?.attention)
1211
+ return declared;
1212
+ const requested = applied.attentionRequested ?? declared.attention;
1213
+ return {
1214
+ ...declared,
1215
+ attention: applied.attention,
1216
+ ...(requested && requested !== applied.attention ? { attentionRequested: requested } : {}),
1217
+ };
1218
+ }
1195
1219
  function formatEnvelope(envelope) {
1196
1220
  const status = envelope.intent.status;
1197
1221
  const suffix = envelope.intent.reason ? ` (${envelope.intent.reason})` : '';
1198
1222
  const destination = describeDestination(envelope.destination);
1199
1223
  const presentation = envelope.presentation
1200
- ? ` [kind=${envelope.presentation.kind}${envelope.presentation.attention ? `, attention=${envelope.presentation.attention}` : ''}${envelope.destination.kind === 'app_owner_dm'
1224
+ ? ` [kind=${envelope.presentation.kind}${envelope.presentation.attention ? `, attention=${envelope.presentation.attention}` : ''}${envelope.presentation.attentionRequested
1225
+ ? ` (requested ${envelope.presentation.attentionRequested})`
1226
+ : ''}${envelope.destination.kind === 'app_owner_dm'
1201
1227
  ? '; reach=user-controlled; presentation=user-controlled'
1202
1228
  : ''}]`
1203
1229
  : '';
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const core_1 = require("@oclif/core");
4
4
  const guest_service_1 = require("../lib/guest-service");
5
+ const BINDING_REFUSED_RE = /revoked|invalid_handle|forbidden/i;
5
6
  /**
6
7
  * `skrr agent-worker` — the long-lived guest agent worker (§10.2).
7
8
  *
@@ -134,7 +135,7 @@ class AgentWorker extends core_1.Command {
134
135
  /** `revoked`/`invalid_handle` — the binding is gone, not the transport. */
135
136
  bindingRefused(error) {
136
137
  const message = error instanceof Error ? error.message : String(error);
137
- return /revoked|invalid_handle|forbidden/i.test(message);
138
+ return BINDING_REFUSED_RE.test(message);
138
139
  }
139
140
  }
140
141
  exports.default = AgentWorker;
@@ -6,6 +6,7 @@ const base_command_1 = require("../../base-command");
6
6
  const agent_resolver_1 = require("../../lib/agent-resolver");
7
7
  const format_1 = require("../../lib/format");
8
8
  const agent_scope_1 = require("../../lib/agent-scope");
9
+ const RUN_RE = /\s+/g;
9
10
  /**
10
11
  * "What has this agent been doing lately?" in one call.
11
12
  *
@@ -103,7 +104,7 @@ class AgentsActivity extends base_command_1.BaseCommand {
103
104
  at: dmRow.lastMessageAt ? String(dmRow.lastMessageAt) : null,
104
105
  id: String(dmRow.conversationId ?? '-'),
105
106
  title: 'Agent DM',
106
- detail: String(dmRow.lastMessagePreview ?? (dmRow.lastMessageAt ? '' : 'no messages yet')).replace(/\s+/g, ' '),
107
+ detail: String(dmRow.lastMessagePreview ?? (dmRow.lastMessageAt ? '' : 'no messages yet')).replace(RUN_RE, ' '),
107
108
  });
108
109
  }
109
110
  const rawConvoItems = Array.isArray(conversations)
@@ -6,17 +6,22 @@ const data_provider_1 = require("@skrr-ai/data-provider");
6
6
  const base_command_1 = require("../../base-command");
7
7
  const agent_ref_1 = require("../../lib/agent-ref");
8
8
  const agent_distribution_1 = require("../../lib/agent-distribution");
9
+ const ESCAPE_HTML_RE = /&/g;
10
+ const ESCAPE_HTML_RE_2 = /</g;
11
+ const ESCAPE_HTML_RE_3 = />/g;
12
+ const ESCAPE_HTML_RE_4 = /"/g;
13
+ const ESCAPE_MARKDOWN_TEXT_RE = /[\\[\]]/g;
9
14
  const FORMATS = ['markdown', 'html', 'rst'];
10
15
  function escapeHtml(value) {
11
16
  return value
12
- .replace(/&/g, '&amp;')
13
- .replace(/</g, '&lt;')
14
- .replace(/>/g, '&gt;')
15
- .replace(/"/g, '&quot;');
17
+ .replace(ESCAPE_HTML_RE, '&amp;')
18
+ .replace(ESCAPE_HTML_RE_2, '&lt;')
19
+ .replace(ESCAPE_HTML_RE_3, '&gt;')
20
+ .replace(ESCAPE_HTML_RE_4, '&quot;');
16
21
  }
17
22
  /** Markdown link text: brackets and backslashes would end or bend the link. */
18
23
  function escapeMarkdownText(value) {
19
- return value.replace(/[\\[\]]/g, (char) => `\\${char}`);
24
+ return value.replace(ESCAPE_MARKDOWN_TEXT_RE, (char) => `\\${char}`);
20
25
  }
21
26
  /**
22
27
  * The README snippet: the badge, linked to the attributed listing, then the
@@ -6,6 +6,7 @@ const core_1 = require("@oclif/core");
6
6
  const data_provider_1 = require("@skrr-ai/data-provider");
7
7
  const base_command_1 = require("../../../base-command");
8
8
  const format_1 = require("../../../lib/format");
9
+ const CATEGORY_DISPLAY_LABEL_RE = /[-_\s]+/;
9
10
  /**
10
11
  * Global default categories are seeded with LOCALIZATION KEYS as their label and
11
12
  * description (`com_agents_category_general`), because the web translates them.
@@ -28,7 +29,7 @@ function categoryDisplayLabel(row) {
28
29
  if (!value)
29
30
  return label || '-';
30
31
  return value
31
- .split(/[-_\s]+/)
32
+ .split(CATEGORY_DISPLAY_LABEL_RE)
32
33
  .filter(Boolean)
33
34
  .map((word) => word[0].toUpperCase() + word.slice(1))
34
35
  .join(' ');
@@ -279,6 +279,7 @@ export default class AgentsChat extends BaseCommand {
279
279
  incremental: import("@oclif/core/interfaces").BooleanFlag<boolean>;
280
280
  jsonl: import("@oclif/core/interfaces").BooleanFlag<boolean>;
281
281
  json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
282
+ 'idempotency-key': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
282
283
  'repair-wait': import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
283
284
  'approve-tools': import("@oclif/core/interfaces").BooleanFlag<boolean>;
284
285
  'permission-mode': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
@@ -23,6 +23,7 @@ const core_1 = require("@oclif/core");
23
23
  const data_provider_1 = require("@skrr-ai/data-provider");
24
24
  const base_command_1 = require("../../base-command");
25
25
  const api_fetch_1 = require("../../lib/api-fetch");
26
+ const agent_chat_start_1 = require("../../lib/agent-chat-start");
26
27
  const agent_home_workspace_1 = require("../../lib/agent-home-workspace");
27
28
  const agentic_stream_1 = require("../../lib/agentic-stream");
28
29
  const web_url_1 = require("../../lib/web-url");
@@ -506,6 +507,13 @@ class AgentsChat extends base_command_1.BaseCommand {
506
507
  json: core_1.Flags.boolean({
507
508
  description: 'Emit the final one-shot response as JSON (use with --no-stream)',
508
509
  }),
510
+ 'idempotency-key': core_1.Flags.string({
511
+ description: 'Name this start (' + agent_chat_start_1.START_KEY_RULE + '). The CLI already names every start and, when ' +
512
+ 'the server does not confirm one (a 502, 503 or 504, or a dropped connection), sends the ' +
513
+ 'same request again so the server returns the turn it accepted instead of starting a ' +
514
+ 'second one. Pass your own key to re-attach to a start from another process: the same ' +
515
+ 'key and prompt return the original turn; a different prompt under it is refused.',
516
+ }),
509
517
  'repair-wait': core_1.Flags.integer({
510
518
  description: 'Seconds to keep waiting when a platform update restarts the server relaying a turn ' +
511
519
  'your machine is still running. The server repairs the reply onto the conversation ' +
@@ -773,23 +781,43 @@ class AgentsChat extends base_command_1.BaseCommand {
773
781
  ? (0, local_skills_1.withSkillInvocations)(flags.prompt, localSkills.refs)
774
782
  : flags.prompt;
775
783
  (0, agent_home_workspace_1.commitAgentHomeWorkspaceDefault)(await homeWorkspace);
784
+ // Every start is named. A start whose answer is lost (the edge's 504, a restarting API,
785
+ // a dropped socket) is usually a turn the server DID accept; without a name the CLI
786
+ // could only report a failure and leave it running, holding balance, with its permission
787
+ // prompts unanswerable (OSK-22631). With one, the same request can be sent again and the
788
+ // server returns the original acceptance.
789
+ const suppliedStartKey = flags['idempotency-key'];
790
+ if (suppliedStartKey !== undefined && !(0, agent_chat_start_1.isValidStartKey)(suppliedStartKey)) {
791
+ this.error(`--idempotency-key must be ${agent_chat_start_1.START_KEY_RULE}.`, { exit: 2 });
792
+ }
793
+ const startKey = suppliedStartKey ?? (0, agent_chat_start_1.newStartKey)();
776
794
  let started;
777
795
  try {
778
- started = await data_provider_1.dataService.startAgenticChat({
796
+ started = await (0, agent_chat_start_1.startWithReplay)(() => data_provider_1.dataService.startAgenticChat({
779
797
  agentId: args.agentId,
780
798
  taskId: boundTaskId,
781
799
  text: contextParts ? `${contextParts}\n\n${prompt}` : prompt,
782
800
  conversationId: threadConversationId,
783
801
  workspaceId: process.env.OVERSKY_WORKSPACE_ID,
802
+ clientRequestId: startKey,
784
803
  // The server resolves each ref against the session's daemon, so the
785
804
  // turn is asked to run on the machine that listed them. An agent whose
786
805
  // execution policy places it elsewhere keeps that placement, and the
787
806
  // run fails saying why rather than running without the skill.
788
807
  ...daemonPinFields(localSkills, flags.daemon),
789
808
  ...permissionModeFields(flags['permission-mode']),
809
+ }), {
810
+ // stderr, so stdout and --json/--jsonl stay parseable.
811
+ onReplay: ({ attempt, of, waitMs }) => this.warn(`The server did not confirm the start; sending the same request again in ` +
812
+ `${Math.round(waitMs / 1000)}s (${attempt}/${of}). It returns the turn it ` +
813
+ `already accepted rather than starting a second one.`),
790
814
  });
791
815
  }
792
816
  catch (err) {
817
+ if (err instanceof agent_chat_start_1.StartNotConfirmed) {
818
+ this.warn((0, agent_chat_start_1.startNotConfirmedHint)(startKey, err.attempts));
819
+ this.handleApiError(err.lastError);
820
+ }
793
821
  // A refused start was the one API error on this command that escaped
794
822
  // `handleApiError`: it fell through to the generic catch, which printed
795
823
  // `HTTP 400 Bad Request — POST …/api/agentic/chat` under the code
@@ -18,6 +18,7 @@ const prompt_1 = require("../../lib/prompt");
18
18
  const agent_config_1 = require("../../lib/agent-config");
19
19
  const web_url_1 = require("../../lib/web-url");
20
20
  const agent_spec_1 = require("../../lib/agent-spec");
21
+ const AGENT_CREATE_MISSING_FIELDS_MESSAGE_RE = /^--/;
21
22
  /**
22
23
  * OSK-4831 — build the missing-fields sentence from the real missing set.
23
24
  *
@@ -35,7 +36,9 @@ const agent_spec_1 = require("../../lib/agent-spec");
35
36
  */
36
37
  function agentCreateMissingFieldsMessage(missing) {
37
38
  const plural = missing.length > 1;
38
- const fields = missing.map((flag) => flag.replace(/^--/, '')).join('/');
39
+ const fields = missing
40
+ .map((flag) => flag.replace(AGENT_CREATE_MISSING_FIELDS_MESSAGE_RE, ''))
41
+ .join('/');
39
42
  return (`${missing.join(' and ')} ${plural ? 'are' : 'is'} required. ` +
40
43
  `Pass ${plural ? 'them' : 'it'}, or include ${fields} in --from-json. ` +
41
44
  '`skrr agents list --json` shows the provider and model of agents you already have, ' +
@@ -5,6 +5,7 @@ const core_1 = require("@oclif/core");
5
5
  const data_provider_1 = require("@skrr-ai/data-provider");
6
6
  const base_command_1 = require("../../base-command");
7
7
  const web_url_1 = require("../../lib/web-url");
8
+ const OPTIONAL_OVERVIEW_SECTION_RE = /\b403\b/;
8
9
  function optionalOverviewSection(section, result) {
9
10
  if (result.status === 'fulfilled')
10
11
  return { value: result.value };
@@ -13,7 +14,7 @@ function optionalOverviewSection(section, result) {
13
14
  // selected workspace. It is optional onboarding context, not an Agent
14
15
  // readiness failure, so an owner inspecting a new Agent should see it as
15
16
  // empty rather than an unexplained 403 that suggests partial creation.
16
- if (section === 'notepad' && /\b403\b/.test(message))
17
+ if (section === 'notepad' && OPTIONAL_OVERVIEW_SECTION_RE.test(message))
17
18
  return { value: null };
18
19
  return { value: null, warning: { section, message } };
19
20
  }
@@ -3,12 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const core_1 = require("@oclif/core");
4
4
  const data_provider_1 = require("@skrr-ai/data-provider");
5
5
  const base_command_1 = require("../../../base-command");
6
+ const BETA_WRITE_MAY_HAVE_COMMITTED_RE = /fetch failed|socket hang up|timed? ?out/i;
6
7
  function betaWriteMayHaveCommitted(error) {
7
8
  const failure = error;
8
9
  const status = failure?.status ?? failure?.response?.status;
9
10
  return status === 408 || (typeof status === 'number' && status >= 500) ||
10
11
  ['ECONNRESET', 'ETIMEDOUT', 'EAI_AGAIN', 'ENOTFOUND'].includes(failure?.code ?? '') ||
11
- /fetch failed|socket hang up|timed? ?out/i.test(failure?.message ?? '');
12
+ BETA_WRITE_MAY_HAVE_COMMITTED_RE.test(failure?.message ?? '');
12
13
  }
13
14
  class AgentsReleasesCreate extends base_command_1.BaseCommand {
14
15
  static description = 'Create a private agent release';
@@ -14,6 +14,7 @@ const triggers_1 = require("../../lib/triggers");
14
14
  const schedule_1 = require("../../lib/schedule");
15
15
  const planOutcome_1 = require("../../lib/planOutcome");
16
16
  const reflection_1 = require("../../lib/reflection");
17
+ const COLLECT_ERRORS_RE = /R$/;
17
18
  /** Board statuses that mean "still open / not done" for the tasks section. */
18
19
  const OPEN_TASK_STATUSES = new Set(['backlog', 'todo', 'in_progress', 'in_review', 'blocked']);
19
20
  /**
@@ -284,7 +285,8 @@ function collectErrors(results) {
284
285
  for (const [key, result] of Object.entries(results)) {
285
286
  if (result.status === 'rejected') {
286
287
  const reason = result.reason;
287
- errors[key.replace(/R$/, '')] = reason instanceof Error ? reason.message : String(reason);
288
+ errors[key.replace(COLLECT_ERRORS_RE, '')] =
289
+ reason instanceof Error ? reason.message : String(reason);
288
290
  }
289
291
  }
290
292
  return Object.keys(errors).length > 0 ? errors : undefined;
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const core_1 = require("@oclif/core");
4
4
  const base_command_1 = require("../../base-command");
5
5
  const triggers_1 = require("../../lib/triggers");
6
+ const DERIVE_LABEL_RE = /\s+/g;
6
7
  /**
7
8
  * `skrr agents schedule <agent-id>` — the one-liner for the most common agent
8
9
  * automation: "run this agent on a cron" or "run it once at a time", sending a
@@ -150,6 +151,6 @@ class AgentsSchedule extends base_command_1.BaseCommand {
150
151
  exports.default = AgentsSchedule;
151
152
  /** Derive a short label from the prompt when the caller doesn't supply one. */
152
153
  function deriveLabel(prompt) {
153
- const trimmed = prompt.trim().replace(/\s+/g, ' ');
154
+ const trimmed = prompt.trim().replace(DERIVE_LABEL_RE, ' ');
154
155
  return trimmed.length <= 60 ? trimmed : `${trimmed.slice(0, 57)}...`;
155
156
  }
@@ -15,6 +15,8 @@ const format_1 = require("../../lib/format");
15
15
  const http_error_1 = require("../../lib/http-error");
16
16
  const web_url_1 = require("../../lib/web-url");
17
17
  const proactiveApi_1 = require("../../lib/proactiveApi");
18
+ const SHELL_QUOTE_RE = /'/g;
19
+ const PROACTIVE_INSTALL_READINESS_RE = /^[A-Za-z0-9_-]+$/;
18
20
  function workerPolicyWindowLines(policy) {
19
21
  const lines = [];
20
22
  for (const [label, window] of [
@@ -163,7 +165,7 @@ async function followSpawnOperation(options) {
163
165
  exports.DECLINE_UNSUPPORTED_MESSAGE = 'This server does not support --minimal/--without yet; nothing was opted out.';
164
166
  /** A value as one POSIX shell word, so a printed command can be pasted as it is. */
165
167
  function shellQuote(value) {
166
- return `'${value.replace(/'/g, `'\\''`)}'`;
168
+ return `'${value.replace(SHELL_QUOTE_RE, `'\\''`)}'`;
167
169
  }
168
170
  /**
169
171
  * One line for the goals, tasks and jobs a spec seeded. The text receipt printed
@@ -199,7 +201,7 @@ function proactiveInstallReadiness(result, bin) {
199
201
  // READY describes setup, not what the Agent does next. A new Agent with Always-On on starts its
200
202
  // first runs in the background, and one that fails shows up in the operating review, not here:
201
203
  // a spawned Agent read READY while its first run had already failed (OSK-22359).
202
- const safeAgent = /^[A-Za-z0-9_-]+$/.test(result.agentId) ? result.agentId : null;
204
+ const safeAgent = PROACTIVE_INSTALL_READINESS_RE.test(result.agentId) ? result.agentId : null;
203
205
  const firstRuns = result.installed.alwaysOn?.desiredEnabled === true && safeAgent;
204
206
  return {
205
207
  status: 'ready',
@@ -222,9 +224,8 @@ function proactiveInstallReadiness(result, bin) {
222
224
  'Change its title and apply the spec again if you want it back.',
223
225
  };
224
226
  }
225
- const ids = [...new Set(affected.map((commitment) => commitment.id))]
226
- .filter((id) => typeof id === 'string' && /^[A-Za-z0-9_-]+$/.test(id));
227
- const safeAgentId = /^[A-Za-z0-9_-]+$/.test(result.agentId) ? result.agentId : null;
227
+ const ids = [...new Set(affected.map((commitment) => commitment.id))].filter((id) => typeof id === 'string' && PROACTIVE_INSTALL_READINESS_RE.test(id));
228
+ const safeAgentId = PROACTIVE_INSTALL_READINESS_RE.test(result.agentId) ? result.agentId : null;
228
229
  // Always-On was still starting when setup finished, so the only thing that
229
230
  // stopped activation was a gate that clears by itself. Say so and name the
230
231
  // command that finishes the job; `commitments preflight` is a dry run that
@@ -299,7 +300,9 @@ function proactiveInstallReadiness(result, bin) {
299
300
  const provisioningOnly = result.warnings.length > 0 &&
300
301
  result.warnings.every((warning) => warning.code === 'proactive_provisioning_incomplete');
301
302
  if (provisioningOnly) {
302
- const inspectAgent = /^[A-Za-z0-9_-]+$/.test(result.agentId) ? result.agentId : null;
303
+ const inspectAgent = PROACTIVE_INSTALL_READINESS_RE.test(result.agentId)
304
+ ? result.agentId
305
+ : null;
303
306
  return {
304
307
  status: 'degraded',
305
308
  message: 'What the spec asked for is installed. Part of the new Agent\u2019s own setup did not finish; ' +
@@ -5,13 +5,14 @@ const core_1 = require("@oclif/core");
5
5
  const data_provider_1 = require("@skrr-ai/data-provider");
6
6
  const base_command_1 = require("../../../base-command");
7
7
  const html_text_1 = require("../../../lib/html-text");
8
+ const CREDENTIAL_HELP_TEXT_RE = /<a\s[^>]*href=['"]([^'"]+)['"][^>]*>(.*?)<\/a>/gi;
8
9
  /**
9
10
  * A credential's help text for a terminal. Plugin manifests write it as HTML
10
11
  * with the signup link in an anchor; stripping the tags alone would keep
11
12
  * "see Our Docs" and drop the URL, which is the part worth printing.
12
13
  */
13
14
  function credentialHelpText(description) {
14
- return (0, html_text_1.htmlToDisplayText)(description.replace(/<a\s[^>]*href=['"]([^'"]+)['"][^>]*>(.*?)<\/a>/gi, '$2 ($1)'));
15
+ return (0, html_text_1.htmlToDisplayText)(description.replace(CREDENTIAL_HELP_TEXT_RE, '$2 ($1)'));
15
16
  }
16
17
  /**
17
18
  * Whether this account has credentials for one tool.
@@ -5,13 +5,14 @@ const core_1 = require("@oclif/core");
5
5
  const data_provider_1 = require("@skrr-ai/data-provider");
6
6
  const base_command_1 = require("../../../base-command");
7
7
  const format_1 = require("../../../lib/format");
8
+ const CLIP_RE = /\s+/g;
8
9
  const clip = (value, width) => {
9
10
  const text = value == null
10
11
  ? ''
11
12
  : typeof value === 'string'
12
13
  ? value
13
14
  : (JSON.stringify(value) ?? String(value));
14
- const flat = text.replace(/\s+/g, ' ').trim();
15
+ const flat = text.replace(CLIP_RE, ' ').trim();
15
16
  return flat.length > width ? `${flat.slice(0, width - 1)}…` : flat;
16
17
  };
17
18
  /**